#!/usr/bin/python
#coding=utf-8
'''
Viene prodotto il grafico per la valutazione della stabilità dell'apparato
'''
from ROOT import TCanvas, TGraph
from myanalisis import set_my_style

#Output folders
path_graph = 'report/graph/stability/'
ifile = 'data/stability/time_countsonVph.dat'

set_my_style('y')
graph_stability = TGraph(ifile)
canvas_stability = TCanvas('canvas_stability', 'canvas_stability', 2)
graph_stability.SetTitle(';Time [s]; Counts / V_{ph} [V^{-1}]')
graph_stability.SetMarkerSize(0.3)
graph_stability.Draw('ap')
canvas_stability.SaveAs(path_graph + 'piezo_relaxing.pdf')

canvas_stability2 = TCanvas('canvas_stability2', 'canvas_stability2', 2)
graph_stability.GetXaxis().SetLimits(40000, 80000)
graph_stability.SetMinimum(1200)
graph_stability.SetMaximum(1350)
graph_stability.Draw('ap')
canvas_stability2.SaveAs(path_graph + 'stability.pdf')
